%%两个点电流源电位及电场分布图
I0 = 20; p = 100; a = -50; b = 50;
i = -100:100;r = 2*i;
j = I0./(2*pi*r.^2);
% if r>a
%     Ua = I0*p./(2*pi*(r-a));
% else
%     Ua = I0*p./(2*pi*(a-r));
% end
% if r>b
%     Ub = I0*p./(2*pi*(r-b));
% else
%     Ub = I0*p./(2*pi*(b-r));
% end
Ua = I0*p./(2*pi*(a-r));
Ub = I0*p./(2*pi*(r-b));

E = j*p;
hold on 
plot(Ua-Ub); 
hold off